// import logo from './logo.svg';
import { Routes, Route, Navigate } from 'react-router-dom';
import './App.css';
import Home from './pages/Home';
import Login from './pages/Login';
import Admin from './pages/Admin'
import NotFound from './pages/NotFound';
import GoodsEdit from './pages/GoodsEdit';

import DashBoard from "./pages/Admin/DashBoard";
import Users from "./pages/Admin/Users";
import Messages from "./pages/Admin/Messages";
import Channels from "./pages/Admin/Channels";
import Goods from "./pages/Admin/Goods";
import Hotwords from "./pages/Admin/Hotwords";

import AjaxDemo from './demos/AjaxDemo';

function App() {
  return (
    <Routes>
      <Route path='/' element={<Home />} />
      <Route path='/login' element={<Login />} />
      <Route path='/goodsedit' element={<GoodsEdit />} />

      <Route path="admin" element={<Admin />}>
        <Route index element={<Navigate to="/admin/dashboard" />} />
        <Route path='dashboard' element={<DashBoard />} />
        <Route path="users" element={<Users />} />
        <Route path="messages" element={<Messages />} />
        <Route path="channels" element={<Channels />} />
        <Route path="goods" element={<Goods />} />
        <Route path="hotwords" element={<Hotwords />} />
      </Route>

      <Route path="admin/goods/0" element={<GoodsEdit mode="new" />} />
      <Route path="admin/goods/:gid" element={<GoodsEdit mode="edit" />} />

      <Route path='demos/ajax' element={<AjaxDemo />} />

      <Route path='*' element={<NotFound />} />
    </Routes>
  );
}

export default App;